package com.cdtye.shuoh.domain.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 设备类型
 * 网关设备：是子设备/边设备的网关
 * 子设备：真实设备
 */
@Getter
@AllArgsConstructor
public enum DeviceType {

    /**
     * 普通设备（无子设备也无父设备）
     */
    COMMON("COMMON","0","普通设备"),

    /**
     * 网关设备(可挂载子设备)
     */
    GATEWAY("GATEWAY","1","网关设备"),

//    /**
//     * 子设备(归属于某个网关设备)
//     */
//    SUBSET("SUBSET","2","子设备"),

    /**
     * Lora转4G网关
     */
    LORA_4G_GATWAY("LORA_4G_GATWAY","3","Lora转4G网关"),

    /**
     * GB28181设备
     */
    GB_28181_DEVICE("GB_28181_DEVICE","4","国标设备");

    private  String key;
    private  String value;
    private String tag;

    public static DeviceType parseByValue(String value){
        if(value == null){
            return null;
        }
        for (DeviceType d : DeviceType.values()) {
            if (d.getValue().equals(value)) {
                return d;
            }
        }
        return null;

    }
}
